#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

class Solution {
public:
    int accountBalanceAfterPurchase(int purchaseAmount)
    {
        if (purchaseAmount >= 5 && purchaseAmount < 10)
            return 100 - 10;
        if (purchaseAmount == 100)
            return 0;
        if (purchaseAmount < 5)
            return 100;
        return (purchaseAmount % 10 >= 5) ? 100 - ((purchaseAmount / 10 + 1) * 10) : 100 - (purchaseAmount / 10 * 10);
    }
};